import Vue from 'vue';
import './cube-ui';
import App from './App.vue';
import router from './router';
import './css/login.css';
import Axios from 'axios';
import Mint from 'mint-ui';
import Vuex from 'vuex';
import VueAMap from 'vue-amap';
import 'mint-ui/lib/style.css';
import moment from 'moment';
import mandMobile from 'mand-mobile';
import 'mand-mobile/lib-vw/mand-mobile.css';

import Cube from 'cube-ui';

Vue.use(Cube);
Vue.use(mandMobile);
Vue.use(Mint);
Vue.use(Vuex);
Vue.use(VueAMap);
require('moment/locale/zh-cn');
Vue.use(require('vue-moment'), {
  moment,
});

Vue.config.productionTip = false;

// 配置高德地图
VueAMap.initAMapApiLoader({
  key: '42c5b0d4ba4e492ee672d612209dfcc1',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  // 默认高德 sdk 版本为 1.4.4
  v: '1.4.4',
});
// 配置接口参数
const _api = Axios.create({
  baseURL: 'http://119.29.162.33:7001', // 本地环境
});
Vue.prototype.$api = _api;


// Vuex配置

const store = new Vuex.Store({
  state: {
    userinfo: {
      uid: '',
      telphone: '',
      username: '',
      sex: 0,
      real_name: '',
      password: '',
      Delete_time: '',
      idcard: '',

    },
    city: '',
  },
  mutations: {
    updateUserinfo(state, r) {
      console.log(r);
      state.userinfo = r;
    },
    updateUseridcard(state, r) {
      console.log(r);
      state.userinfo.idcard = r;
    },
    updatarname(state, r) {
      console.log(r);
      state.userinfo.real_name = r;
    },
    updateUserpwd(state, r) {
      state.userinfo.password = r;
    },
    updataCity(state, r) {
      state.city = r;
    },
  },
});


new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app');
